1. Field of the Invention
The present invention relates to image processing. More particularly, the present invention relates to image filtering and specifically to fast detail-preserving image filtering.
2. The Prior Art
A digital image with R rows and S columns can be seen as a two-dimensional array of pixels x(r,s), where r=1, 2, . . . , R and s=1, 2, . . . , S denote the row and column coordinates, respectively. The input image can be processed by the traditional anisotropic diffusion filter as follows:
                              x                      (                          r              ,              s                        )                                [                          i              +              1                        ]                          =                              x                          (                              r                ,                s                            )                                      [              i              ]                                +                      λ            ⁢                                          ∑                                                      (                                          g                      ,                      h                                        )                                    ∈                  ζ                                            ⁢                                                          ⁢                              [                                                      f                    ⁡                                          (                                                                        x                                                      (                                                          r                              ,                              s                                                        )                                                                                [                            i                            ]                                                                          ,                                                  x                                                      (                                                          g                              ,                              h                                                        )                                                                                [                            i                            ]                                                                                              )                                                        ·                                      (                                                                  x                                                  (                                                      r                            ,                            s                                                    )                                                                          [                          i                          ]                                                                    -                                              x                                                  (                                                      g                            ,                            h                                                    )                                                                          [                          i                          ]                                                                                      )                                                  ]                                                                        (        1        )            where i denotes the iteration index, with i=0 indicating the input (unprocessed) image. The term ζ={(r−1,s), (r,s−1), (r,s+1), (r+1,s)} denotes the neighboring pixels located above, left, right, and below with respect to the pixel location (r,s) under consideration. The term ƒ(·) denotes the edge-sensing function which can be defined as follows:
                              f          ⁡                      (                          a              ,              b                        )                          =                  1                      1            +                                                            (                                      a                    -                    b                                    )                                2                            /                              κ                2                                                                        (        2        )            where κ is a predetermined parameter, for example, set as κ=2.
The filtering procedure first selects the actual pixel x(r,s) to be filtered. Then, the four neighbors for x(g,h), for (g,h)εζ and ζ={(r−1,s),(r,s−1), (r,s+1), (r+1,s)}, located above, left, right, and below with respect to the pixel location (r,s) under consideration are selected. Note that the pixel location above, left to, right to and below the actual location (r,s) are indicated as (r−1,s), (r,s−1), (r,s+1), and (r+1,s), respectively. Then, the difference between x(r,s) and each of its four neighbors is calculated; these four differences are indicated as x(r,s)[i]−x(g,h)[i], for (g,h)εζ. Each of these four differences is associated with the weight ƒ(x(r,s)[i], x(g,h)[i]) calculated using Equation (2). Once the differences and weights are obtained, the actual pixel x(r,s) is adjusted by adding to its value the value of λ·Σ[ƒ(x(r,s)[i],x(g,h)[i])·(x(r,s)[i]−x(g,h)[i])] which represents the weighted sum of differences between the actual pixel and its four neighbors, the sum is scaled by the parameter, λ which controls the level of this adjustment.
The filtering process then moves to next pixel location and executes the above procedure. The procedure is repeated in all pixel locations of the input image until all pixels are processed. This gives one iteration, which is indicated in Equation (1) using index [i+1] where [i] refers to the input image (for i=0) or the image obtained in previous iteration (for i>0).
Anisotropic diffusion is an iterative filtering process; reasonable quality of the filtered image is usually achieved after a number of iterations, which may not be suitable for real-time processing. This iterative processing requires performing Equation (1) in each pixel location of the input image to produce an image to be used as the input in the subsequent iteration.